using System;
using System.Windows.Forms;
using AssetManagementSystem.Model;
using AssetManagementSystem.Utils;
using AssetManagementSystem.Utils.Events;

namespace AssetManagementSystem.View.Controls {
    public partial class UiAddStudent : System.Windows.Forms.Form {

        public EventHandler<StudentEventArgs> Student_Create;

        public UiAddStudent() {
            InitializeComponent();
        }

        private void btnSave_Click(object sender, EventArgs e) {
            if (txtStudentNumber.Text == "") {
                MessageBox.Show("Please enter a student number");
            } else {
                this.Student_Create.Invoke(this, new StudentEventArgs(
                    new Student(txtStudentNumber.Text, txtStudentFName.Text, txtStudentLName.Text, txtStudentEmail.Text)
                ));
                this.Close();
            }
        }

        private void btnCancel_Click(object sender, EventArgs e) {
            this.Close();
        }
    }
}
